home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 38 / Amiga Format CD38 (1999-03-15)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-04].iso / -seriously_amiga- / programming / other / ira_src / iraguimain.c < prev    next >
C/C++ Source or Header  |  1999-02-03  |  3KB  |  130 lines

  1. /* Compile me to get full executable. */
  2.  
  3. #include <stdio.h>
  4. #include "iraGUI.c"
  5.  
  6. /* Cut the core out of this function and edit it suitably. */
  7.  
  8. void ProcessWindowIRAPref0( LONG Class, UWORD Code, APTR IAddress )
  9. {
  10. struct Gadget *gad;
  11. switch ( Class )
  12.     {
  13.     case IDCMP_GADGETUP :
  14.         /* Gadget message, gadget = gad. */
  15.         gad = (struct Gadget *)IAddress;
  16.         switch ( gad->GadgetID ) 
  17.             {
  18.             case Win0_Gad0 :
  19.                 /* Cycle changed   , Text of gadget : CPU */
  20.                 break;
  21.             case Win0_Gad1 :
  22.                 /* Cycle changed   , Text of gadget : FPU */
  23.                 break;
  24.             case Win0_Gad2 :
  25.                 /* Cycle changed   , Text of gadget : MMU */
  26.                 break;
  27.             case IRAPref0_Gad3 :
  28.                 /* CheckBox changed, Text of gadget : Append address and data. */
  29.                 break;
  30.             case IRAPref0_Gad4 :
  31.                 /* CheckBox changed, Text of gadget : Show hunkstructure. */
  32.                 break;
  33.             case IRAPref0_Gad5 :
  34.                 /* CheckBox changed, Text of gadget : Scan for data/text and code. */
  35.                 break;
  36.             case IRAPref0_Gad6 :
  37.                 /* CheckBox changed, Text of gadget : Load configfile. */
  38.                 break;
  39.             case IRAPref0_Gad7 :
  40.                 /* CheckBox changed, Text of gadget : Put each section in its own file. */
  41.                 break;
  42.             case IRAPref0_Gad10 :
  43.                 /* CheckBox changed, Text of gadget : Keep binary data. */
  44.                 break;
  45.             case IRAPref0_Gad11 :
  46.                 /* CheckBox changed, Text of gadget : Leave empty hunks away. */
  47.                 break;
  48.             case IRAPref0_Gad13 :
  49.                 /* String entered  , Text of gadget : Offset to relocate at. */
  50.                 break;
  51.             case IRAPref0_Gad14 :
  52.                 /* String entered  , Text of gadget : Entry of code scanning. */
  53.                 break;
  54.             case IRAPref0_Gad15 :
  55.                 /* Cycle changed   , Text of gadget : Base register */
  56.                 break;
  57.             case IRAPref0_Gad16 :
  58.                 /* String entered  , Text of gadget : Base address. */
  59.                 break;
  60.             case IRAPref0_Gad17 :
  61.                 /* String entered  , Text of gadget : Base section. */
  62.                 break;
  63.             case IRAPref0_Gad18 :
  64.                 /* Button pressed  , Text of gadget : Save */
  65.                 break;
  66.             case IRAPref0_Gad19 :
  67.                 /* Button pressed  , Text of gadget : Use */
  68.                 break;
  69.             case IRAPref0_Gad20 :
  70.                 /* Button pressed  , Text of gadget : Cancel */
  71.                 break;
  72.             }
  73.         break;
  74.     case IDCMP_CLOSEWINDOW :
  75.         /* CloseWindow Now */
  76.         break;
  77.     case IDCMP_REFRESHWINDOW :
  78.         GT_BeginRefresh( IRAPref0);
  79.         /* Refresh window. */
  80.     RendWindowIRAPref0( IRAPref0, IRAPref0VisualInfo );
  81.         GT_EndRefresh( IRAPref0, TRUE);
  82.     GT_RefreshWindow( IRAPref0, NULL);
  83.     RefreshGList( IRAPref0GList, IRAPref0, NULL, ~0);
  84.         break;
  85.     }
  86. }
  87.  
  88.  
  89. int main(void)
  90. {
  91. int done=0;
  92. ULONG class;
  93. UWORD code;
  94. struct Gadget *pgsel;
  95. struct IntuiMessage *imsg;
  96. if (OpenLibs()==0)
  97.     {
  98.     OpenbaseCatalog(NULL,NULL);
  99.     OpenDiskFonts();
  100.     if (OpenWindowIRAPref0()==0)
  101.         {
  102.         while(done==0)
  103.             {
  104.             Wait(1L << IRAPref0->UserPort->mp_SigBit);
  105.             imsg=GT_GetIMsg(IRAPref0->UserPort);
  106.             while (imsg != NULL )
  107.                 {
  108.                 class=imsg->Class;
  109.                 code=imsg->Code;
  110.                 pgsel=(struct Gadget *)imsg->IAddress; /* Only reference if it is a gadget message */
  111.                 GT_ReplyIMsg(imsg);
  112.                 ProcessWindowIRAPref0(class, code, pgsel);
  113.                 /* The next line is just so you can quit, remove when proper method implemented. */
  114.                 if (class==IDCMP_CLOSEWINDOW)
  115.                     done=1;
  116.                 imsg=GT_GetIMsg(IRAPref0->UserPort);
  117.                 }
  118.             }
  119.         
  120.         CloseWindowIRAPref0();
  121.         }
  122.     else
  123.         printf("Cannot open window.\n");
  124.     ClosebaseCatalog();
  125.     CloseLibs();
  126.     }
  127. else
  128.     printf("Cannot open libraries.\n");
  129. }
  130.